<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    response.setHeader("X-Frame-Options","SAMEORIGIN");
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"+ request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <jsp:include page="../../public/public.jsp"/>
<body>

<!-- end -->
<table id="dg" style="width:100%;height: 320px;" data-options="
				url:'<%=basePath %>employee/queryEmployeeCertificate?userId=${sessionScope.userinfo.id}&&issued=' + '1' ,
				rownumbers:true,
				singleSelect:true,
				autoRowHeight:false,
				pagination:true,
				pageSize:10">
    <thead>
    <tr>
        <th field="username" width="12%" align="center">姓名</th>
        <th field="sex" width="6%" align="center">性别</th>
        <th field="education" width="8%" align="center">学历</th>
        <th field="major" width="12%" align="center">专业</th>
        <th field="phoneNum" width="15%" align="center">电话号码</th>
        <th field="idNum" width="20%" align="center">身份证号</th>
        <th field="createTimeStr" width="15%" align="center">创建时间</th>
       <%-- <th field="createTimeStr" width="8%" align="center">获证</th>--%>
    </tr>
    </thead>
</table>

<!-- 分配权限窗口 end -->
<script>
    $(function(){
        /* 分页 */
        var pager = $('#dg').datagrid().datagrid('getPager');

    })
    // 重新载入当前页面数据
    function refresh(){
        $('#dg').datagrid('reload');
    }

    //启用/删除
    function qidel(id,value){
        var isDel = "";
        var delName="";
        if(value=='1'){
            isDel='2';
            delName="禁用";
        }
        if(value=='2'){
            isDel='1';
            delName="启用";
        }

        $.messager.confirm('确认','您确认想要 [ '+delName+' ] 数据吗？',function(r){
            if (r){
                $.ajax({
                    url:'<%=basePath %>user/updateUser',
                    type:'post',
                    data:{
                        "id":id,
                        "isDel":isDel
                    },
                    dataType:'json',
                    error:function(){
                        $.messager.alert("提示",delName+"异常","error");
                    },
                    success:function(map){
                        var row = map.row;
                        if(row>=0){
                            $.messager.alert("提示",delName+"成功","info");
                            $('#dg').datagrid("reload");
                            return;
                        }else{
                            $.messager.alert("提示",delName+"失败","error");
                            return;
                        }
                    }
                });
            }
        });
    }


</script>

</body>
</html>